<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>货品入库明细管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnExport").click(function(){
				top.$.jBox.confirm("确认要导出货品入库明细数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						$("#searchForm").attr("action","${ctx}/ka/productInstockDetail/export");
						$("#searchForm").submit();
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/ka/productInstockDetail/list");
			$("#searchForm").submit();
        	return false;
        }
		
		function clearForm(){
			$("#categoryId").val('');
			$("#productCode").val('');
			$("#supplierId").val('');
			$("#startDate").val('');
			$("#endDate").val('');
			$("#searchForm").attr("action","${ctx}/ka/productInstockDetail/list");
			$("#searchForm").submit();
        	return false;
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/ka/productInstockDetail/">货品入库明细列表</a></li>
		<shiro:hasPermission name="ka:productInstockDetail:edit"><li><a href="${ctx}/ka/productInstockDetail/form">货品入库明细添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="productInstockDetail" action="${ctx}/ka/productInstockDetail/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>品类：</label>
				<form:select path="categoryId" class="input-medium">
					<form:option value="" label="全部"/>
					<form:options items="${fns:getCategory() }" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>供应商：</label>
				<form:select path="supplierId" class="input-medium" >
					<form:option value="" label="全部"/>
					<form:options items="${fns:getSupplier()}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>货号：</label>
				<form:input path="productCode" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li class="clearfix"></li>
		</ul>
		<ul class="ul-form">
			<li><label>状态：</label>
				<form:select path="state" class="input-medium">
					<form:option value="" label="全部"></form:option>
					<form:option value="0" label="正常入库"></form:option>
					<form:option value="6" label="退货（非残次品）"></form:option>
					<form:option value="7" label="退货（残次品）"></form:option>
				</form:select>
			</li>
			<li><label>入库时间：</label>
				<input name="startDate" id="startDate" type="text"  maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${productInstockDetail.startDate}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>至<input name="endDate" id="endDate" type="text"  maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${productInstockDetail.endDate}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="button" onclick="clearForm()" value="重置"/></li>
			<li class="btns"><input id="btnExport" class="btn btn-primary" type="button" value="导出"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>品类</th>
				<th>货号</th>
				<th>供应商</th>
				<th>尺码</th>
				<th>颜色</th>
				<th>入库件数</th>
				<th>入库价格</th>
				<th>货架</th>
				<th>入库时间</th>
				<th>状态</th>
				<shiro:hasPermission name="ka:productInstockDetail:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="productInstockDetail">
			<tr>
				<td>
					${productInstockDetail.categoryName}
				</td>
				<td>
					${productInstockDetail.productCode}
				</td>
				<td>
					${productInstockDetail.supplierName}
				</td>
				<td>
					${productInstockDetail.sizeName}
				</td>
				<td>
					${productInstockDetail.colorName}
				</td>
				<td>
					${productInstockDetail.num}
				</td>
				<td>
					${productInstockDetail.price}
				</td>
				<td>
					${productInstockDetail.gridNo}
				</td>
				<td>
					<fmt:formatDate value="${productInstockDetail.instockDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<c:if test="${productInstockDetail.state==0}">正常入库</c:if>
					<c:if test="${productInstockDetail.state==6}">退货(非残次品)</c:if>
					<c:if test="${productInstockDetail.state==7}">退货(残次品)</c:if>
				</td>
				<td>
    				<shiro:hasPermission name="ka:productInstockDetail:edit"><a href="${ctx}/ka/productInstockDetail/form?id=${productInstockDetail.id}">修改</a></shiro:hasPermission>
					<shiro:hasPermission name="ka:productInstockDetail:delete"><a href="${ctx}/ka/productInstockDetail/delete?id=${productInstockDetail.id}" onclick="return confirmx('确认要删除该货品入库明细吗？', this.href)">删除</a></shiro:hasPermission>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<table align="right" border="0">
		<tr>
			<td>合计：</td>
			<td>总件数:${statistics.total }(件)&nbsp;&nbsp;</td>
			<td>总入库价格：${statistics.instockPriceTotal }(元)</td>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td>平均入库价格:${statistics.instockPriceAvg }(元)</td>
		</tr>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>